package com.yy.exception;

import com.yy.domain.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Description:
 * @ClassName: GlobalException
 * @author: 姚欣宏
 * @date: 2023.11.01
 */
@RestControllerAdvice
@Slf4j
public class GlobalException {
    /**
     * 服务异常
     */
    @ResponseStatus(HttpStatus.OK)
    @ExceptionHandler(Exception.class)
    public ResponseResult handlerException(Exception e) {
        log.error(e.getMessage());
        return ResponseResult.fail(e.getMessage());
    }
}

